import { ElMessage } from 'element-plus';
export function useCode() {
  //code验证
  const tackleCode = (code: number) => {
    //请求成功
    if (code === 200) {
      return true;
    }
    //参数错误
    else if (code === 400) {
      ElMessage({
        message: '参数错误',
        type: 'error',
      });
      return false;
    } else {
      ElMessage({
        message: '未知错误',
        type: 'error',
      });
    }
  };

  return {
    tackleCode,
  };
}
